// +---------------------
// | 接口
// +---------------------
// import { request } from "@/common/request";
import { request } from "../common/request";
/**
 * 获取某个频道的消息
 * @param {*} data
 * @returns
 */
export function getChannelMessagesById(data: any) {
  return request({
    url: `/online/get-channel-messages-by-id`,
    method: "get",
    data,
  });
}

/**
 * 授权  (链接断开时需要重新获取)
 * @param {*} data
 * @returns
 */
export function getImAuthToken(data: any) {
  return request({
    url: `/online/get-im-auth-token`,
    method: "get",
    data,
  });
}

/**
 * 获取用户长连接地址
 * @param {*} data
 * @returns
 */
export function getImRoute(data: any) {
  return request({
    url: `/online/get-im-route`,
    method: "get",
    data,
  });
}

/**
 * 获取在线的客服列表
 * @param {*} data
 * @returns
 */
export function getServicePersonList(data: any) {
  return request({
    url: `/online/get-service-person-list`,
    method: "get",
    data,
  });
}

/**
 * 客户-访客发起会话（频道）
 * @param {*} data
 * @returns
 */
export function initiateConversation(data: any) {
  return request({
    url: `/online/initiate-conversation`,
    method: "post",
    data,
  });
}

/**
 * 结束会话
 * @param {*} data
 * @returns
 */
export function removeConversation(data: any) {
  return request({
    url: `/online/remove-conversation`,
    method: "get",
    data,
  });
}

/**
 * 获取某个会话的信息
 * @param {*} data
 * @returns
 */
export function channelDetailByParams(data: any) {
  return request({
    url: `/online/channel-detail-by-params`,
    method: "get",
    data,
  });
}

/**
 * 获取排队消息
 * @param {{channelId: string, uid: string}} data
 * @returns
 */
export function getLineUpMessage(data: any) {
  return request({
    url: `/online/get-line-up-message`,
    method: "get",
    data,
  });
}

/**
 * 获取客服会话设置
 * @param {{dataType  : string}} data dataType 1-会话分配设置 2-会话转接设置 3-基础设置
 * @returns
 */
export function getKfConversationSetting(data: any) {
  return request({
    url: `/kfConversationSetting/detail-by-data-type`,
    method: "get",
    data,
  });
}


/**
 * 在线留言
 * @returns
 */
export function savekfLeaveMessage(data: any) {
  return request({
    url: `/kfLeaveMessage/save`,
    method: "post",
    data,
  });
}


/**
 * 获取知识库分类 列表
 * @param {{level  : number}} data level 1-一级分类 2-二级分类...
 * @returns
 */
export function getkfKnowledgeBaseTypeList(data: any) {
  return request({
    url: `/kfKnowledgeBaseType/list`,
    method: "get",
    data,
  });
}


/**
 * 获取知识库 知识 分页
 * @param {{current  : number, size: number, parentId  : number}} data 
 * @returns
 */
export function getkfKnowledgeBasePage(data: any) {
  return request({
    url: `/kfKnowledgeBase/page`,
    method: "get",
    data,
  });
}
